package com.proj.springbootdemo.logic;

import base.BaseLogic;
import base.BaseReturn;
import com.proj.springbootdemo.dao.model.gen.Books;
import com.proj.springbootdemo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Logic层
 *   统一抛 LogicException
 *   统一返回 BaseReturn<T>
 *
 * @author liujia
 */
@Component()
public class DemoLogic implements BaseLogic {

    @Autowired
    private DemoService demoService;

    public BaseReturn demoMethod() {
        Books b = demoService.getBook();
        return new BaseReturn(b);
    }

    public BaseReturn demoMethodExc() {
        Books b = demoService.getBookExc();
        return new BaseReturn(b);
    }
}
